﻿
// 2018/6/20: 首版
// 2018/6/25: calBoxCorners改为输出8点。优化BoxCenter模式下calObjClosestPoint
// 2018/8/22(9/25): 支持v5，calOverlap类型补充
// 2019/8/8: 根据后轴位置修正重叠率计算和相对/绝对速度转换
// 2019/8/28: 优化前向关键目标物(CIPV)提取算法
// 2020/1/15: 支持v6，移除指标计算和calBoxCorners
// 2020/5/25: 支持计算目标物横摆角速度和曲率
// 2020/9/29: 修改public字段为raw字段
// 2020/11/2: 修正后向目标cpd计算问题
// 2022/4/6: 计算目标物轨迹也可使用本车曲率
// 2023/2/13: 支持框架软件4.3
// 2023/10/9: 增加英文注释
// 2023/10/27: 不使用pragma once
// 2023/11/6: 修正目标物轨迹生成
// 2024/7/3: 基于新样本框架和obj-sensor-sample-v7

#ifndef OBJ_FUNC_H
#define OBJ_FUNC_H

#include "spadas.h"
#include "obj-sensor-sample-v7.h"

namespace objcalc
{
	using namespace spadas;
	using namespace obj_sensor_sample_v7;

	void calObjVelAndTrack(ObjectSensorSample currentSample, Optional<ObjectSensorSample> lastSampleO, UInt& idCounter, Bool calcVelocity, Bool calcAccel, OptionalDouble vehiSpeed, OptionalDouble vehiAX, OptionalDouble vehiYawRate, OptionalDouble vehiCurv);
	void calAbsVelAndAccel(ObjectSensorSample currentSample, OptionalDouble vehiSpeed, OptionalDouble vehiCurv, OptionalDouble vehiAX, OptionalDouble vehiAY, OptionalDouble vehiOverhang, OptionalDouble vehiWheelbase);
	void calObjHeadingAndSteering(ObjectSensorSample currentSample, Optional<ObjectSensorSample> lastSampleO, OptionalDouble vehiYawRate);
	void calObjClosestPoint(ObjectSensorSample currentSample, OptionalDouble vehiWid, OptionalDouble vehiLen);
	OptionalInt findKOFront(ObjectSensorSample sample, OptionalInt lastKOFrontID);
	OptionalInt findKOSide(ObjectSensorSample sample, Bool isRightSide);
	Double calDistanceToVehicle(Point2D pt, Double vehicleWidth, Double vehicleLength);
}

#endif